package com.devilvan.betrice.aiqicha.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.devilvan.betrice.aiqicha.dto.AiqichaTenderBiddingDto;
import com.devilvan.betrice.aiqicha.po.AiqichaTenderBiddingPo;
import com.devilvan.betrice.aiqicha.service.AiqichaTenderBiddingService;
import com.devilvan.betrice.aiqicha.mapper.AiqichaTenderBiddingMapper;
import com.devilvan.betrice.aiqicha.repository.AiqichaTenderBiddingRepository;
import com.devilvan.betrice.util.UCopy;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
* @author Evad.Wu
* @Description 爱企查-招/投标信息 业务逻辑类
* @date 2022-09-24
*/
@Service
public class AiqichaTenderBiddingServiceImpl extends ServiceImpl<AiqichaTenderBiddingMapper, AiqichaTenderBiddingPo> implements AiqichaTenderBiddingService {
    @Resource(name = "aiqichaTenderBiddingRepository")
    private AiqichaTenderBiddingRepository aiqichaTenderBiddingRepository;

    @Override
    public AiqichaTenderBiddingPo saveUpdate(AiqichaTenderBiddingDto aiqichaTenderBiddingDto) {
        AiqichaTenderBiddingPo aiqichaTenderBiddingPo = new AiqichaTenderBiddingPo();
        UCopy.fullCopy(aiqichaTenderBiddingDto, aiqichaTenderBiddingPo);
        return aiqichaTenderBiddingRepository.saveAndFlush(aiqichaTenderBiddingPo);
    }

    @Override
    public List<AiqichaTenderBiddingPo> saveUpdateBatch(List<AiqichaTenderBiddingDto> list) {
        List<AiqichaTenderBiddingPo> aiqichaTenderBiddingPoList = UCopy.fullCopyCollections(list, AiqichaTenderBiddingPo.class);
        return aiqichaTenderBiddingRepository.saveAllAndFlush(aiqichaTenderBiddingPoList);
    }
}
